from sqlalchemy import Column, ForeignKey
from sqlalchemy.types import Integer, String
from sqlalchemy.orm import relationship
from __init__ import Base

class UserGroup(Base):

    __tablename__ = "usergroup"

    userid = Column(Integer, ForeignKey('users.id'), primary_key=True)
    groupid = Column(Integer, ForeignKey('groups.id'), primary_key=True)

    group = relationship("Groups")

    def __init__(self, userid, groupid):
        self.userid = userid
        self.groupid = groupid

    def __repr__(self):
        return "<UserGroup('%s', '%s')>" % (self.userid, self.groupid)
